<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @fileOverview 뷰어 > 지면뷰어 > 툴바 > 전체면보기 레이어의 모델
<span class='line'>  3</span>  * @author oz_moon
<span class='line'>  4</span>  */</span><span class="WHIT">
<span class='line'>  5</span> </span><span class="NAME">nhn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.nhn</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  6</span> </span><span class="NAME">nhn.newsstand</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  7</span> </span><span class="NAME">nhn.newsstand.viewer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand.viewer</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  8</span> </span><span class="NAME">nhn.newsstand.viewer.allpaper</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand.viewer.allpaper</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  9</span> </span><span class="NAME">nhn.newsstand.viewer.allpaper.Model</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Class</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 10</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 11</span> </span><span class="WHIT">	</span><span class="COMM">/** @lends nhn.newsstand.viewer.allpaper.Model.prototype */</span><span class="WHIT">
<span class='line'> 12</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 13</span> 	 * 브라우저 대비 레이어 사이즈 비율
<span class='line'> 14</span> 	 */</span><span class="WHIT">
<span class='line'> 15</span> </span><span class="WHIT">	</span><span class="NAME">RATE_WIDTH</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0.6</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 16</span> </span><span class="WHIT">	</span><span class="NAME">RATE_HEIGHT</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0.8</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 18</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 19</span> 	 * nhn.newsstand.viewer.allpaper.Model 클래스의 인스턴스를 생성한다.
<span class='line'> 20</span> 	 * @constructs
<span class='line'> 21</span> 	 * @class 뷰어 > 지면뷰어 > 툴바 > 전체면보기 레이어의 모델
<span class='line'> 22</span> 	 * @requires window.ImageUrlGenerator
<span class='line'> 23</span> 	 * @requires nhn.newsstand.common.util
<span class='line'> 24</span> 	 * @example
<span class='line'> 25</span> 	 * var oModel = new nhn.newsstand.viewer.allpaper.Model();
<span class='line'> 26</span> 	 */</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">	</span><span class="NAME">$init</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 30</span> 	 * 상위 엘리먼트에 하위 엘리먼트를 중앙 정렬 시 offset값을 계산하여 반환한다.
<span class='line'> 31</span> 	 * @param {HashTable} htPSize 상위 엘리먼트의 사이즈
<span class='line'> 32</span> 	 * @param {HashTable} htCSize 하위 엘리먼트의 사이즈
<span class='line'> 33</span> 	 * @return {HashTable} 위치값(top, left) 
<span class='line'> 34</span> 	 */</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT">	</span><span class="NAME">_calculateOffset</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htPSize</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htCSize</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">			</span><span class="STRN">"top"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">htPSize.height</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">htCSize.height</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">			</span><span class="STRN">"left"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">htPSize.width</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">htCSize.width</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="WHIT">
<span class='line'> 39</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 40</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 41</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 42</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 43</span> 	 * 상위 엘리먼트의 일정 배율에 해당하는 사이즈를 계산하여 반환한다.
<span class='line'> 44</span> 	 * @param {HashTable} htPSize 	상위 엘리먼트의 사이즈
<span class='line'> 45</span> 	 * @param {HashTable} htMinSize	최소 사이즈
<span class='line'> 46</span> 	 * @return {HashTable} 사이즈값(width, height)
<span class='line'> 47</span> 	 */</span><span class="WHIT">
<span class='line'> 48</span> </span><span class="WHIT">	</span><span class="NAME">_calculateSize</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htPSize</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htMinSize</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">			</span><span class="STRN">"width"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">Math.max</span><span class="PUNC">(</span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="NAME">htPSize.width</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NAME">this.RATE_WIDTH</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htMinSize.width</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">			</span><span class="STRN">"height"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">Math.max</span><span class="PUNC">(</span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="NAME">htPSize.height</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NAME">this.RATE_HEIGHT</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htMinSize.height</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 56</span> 	 * 브라우저의 가로 60%, 세로 80%의 사이즈와 중앙에 띄우기 위한 좌표값을 반환한다.
<span class='line'> 57</span> 	 * @param {HashTable} htMinSize 레이어의 최소 사이즈
<span class='line'> 58</span> 	 * @return {HashTable} 사이즈, 위치값(top, left, width, height)
<span class='line'> 59</span> 	 */</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">	</span><span class="NAME">getLayerInfo</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htMinSize</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">htClientSize</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Document</span><span class="PUNC">(</span><span class="NAME">document</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">clientSize</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">htLayerSize</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._calculateSize</span><span class="PUNC">(</span><span class="NAME">htClientSize</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htMinSize</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">htLayerOffset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._calculateOffset</span><span class="PUNC">(</span><span class="NAME">htClientSize</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htLayerSize</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 66</span> </span><span class="WHIT">			</span><span class="STRN">"top"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">htLayerOffset.top</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT">			</span><span class="STRN">"left"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">htLayerOffset.left</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">			</span><span class="STRN">"width"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">htLayerSize.width</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">			</span><span class="STRN">"height"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">htLayerSize.height</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 74</span> 	 * 원본 테이터를 전체 면 목록에 표시될 데이터의 포멧으로 변환한다. 
<span class='line'> 75</span> 	 * @param {HashTable} htData	원본 데이터
<span class='line'> 76</span> 	 * @return {Array} 면목록을 구성할 데이터 목록(nPageNo, sImgUrl, sTitle, sPressCd)
<span class='line'> 77</span> 	 */</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT">	</span><span class="NAME">getContent</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htData</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">aPaper</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htData.pages.page</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">aContent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 81</span> 
<span class='line'> 82</span> </span><span class="WHIT">		</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nLen</span><span class="PUNC">=</span><span class="NAME">aPaper.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">&lt;</span><span class="NAME">nLen</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">htPage</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">aPaper</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nPage</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htPage.pageNo</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">			</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sImgUrl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ImageUrlGenerator</span><span class="PUNC">(</span><span class="STRN">"news"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"110_"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htPage.pressCd</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htPage.publDate</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htPage.publType</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htPage.editionNo</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nPage</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">createImageUrl</span><span class="PUNC">(</span><span class="NAME">window.NORMAL_URL</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sTitle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oUtil.addZero</span><span class="PUNC">(</span><span class="NAME">nPage</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">htPage.sectionNm</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">			</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="WHIT">			</span><span class="NAME">aContent.push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">				</span><span class="STRN">"nPageNo"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">nPage</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">				</span><span class="STRN">"sImgUrl"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">sImgUrl</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">				</span><span class="STRN">"sTitle"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">sTitle</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">				</span><span class="STRN">"sPressCd"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="NAME">aPaper</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">pressCd</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">aContent</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 98</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'>100</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>